var Online={
   ip:"",
   status:"",
   init:function(ip){
      this.ip=ip;
      this.status=this.getIPStatus(ip);
   },
   getIPStatus:function(){
      var status= false;
      var res = shell("ping -c 1 "+this.ip+"");
      if(res.code == 0){
         console.log("手机在线中..");
         return true; 
      }else{
         console.log("手机离线中..");
         return false; 
      }
     
     },
   isChange:function(){
      var resMap = new Object(); 
      var curStatus= this.getIPStatus(this.ip);
      console.log("手机当前状态:"+curStatus);
      console.log("手机原来状态:"+this.status);
      resMap.change=this.status!=curStatus;
      resMap.online=curStatus;
      this.status=curStatus;
     return resMap;
  },
  
  out:function(text){
      log(text);
  }
}

module.exports = Online;
